<?php
	
		function url($url){


	
	
		$urlsize=1024*1024*30;
		if ($url['size']>$urlsize) {
			echo '<script>alert("文件过大");history.go(-1);</script>';die;
		};
		$ipos=stripos($url['type'],'/');

	    $type=substr($url['type'],$ipos+1);

	
		$urltype=array('jpeg','jpg','gif','png');

		if (!in_array($type,$urltype)) {
			echo '<script>alert("类型错误");history.go(-1);</script>';die;
		};

		$urlname=date('YmdHis').mt_rand(100000,10000000000);

		$urlname.='.'.$type;

		$spath='uploads/'.date('Y-m').'/'.date('d').'/';

		if (!file_exists($spath)) {
			mkdir($spath,777,true);
		}
		$path=$spath.$urlname;
	 
		move_uploaded_file($url['tmp_name'],  $path);

		$thumapath=thumb($spath,$urlname);

		return $thumapath ;
		
		}

	
		
		
	
		
	
	

?>